/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package homework1server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author apple
 */
public class Server {

    /**
     * @param args the command line arguments
     */
    private ServerSocket serverSocket;
    private Socket socket;
    
    public Server(){
        try {
            serverSocket = new ServerSocket(8000);
            System.out.println("Server Start");
            while(true){
                
                socket = serverSocket.accept();
                ServerThread st= new ServerThread(socket);
                new Thread(st).start();
                st.sendMsg(socket, "Welcome to Hangman Game");
            }
        } catch (IOException e) {
            System.out.println(e.toString());
        }
        
    }
    public static void main(String[] args){
        new Server();
    }
    
}
